Skip to content

datner/acquire disposable#6209

Open
datner wants to merge 4 commits intoEffect-TS:next-minorfrom
datner:datner/acquire-disposable
Open

datner/acquire disposable#6209
datner wants to merge 4 commits intoEffect-TS:next-minorfrom
datner:datner/acquire-disposable

Conversation

@datner
Copy link
Copy Markdown
Contributor

@datner datner commented May 4, 2026

  • feat(effect): add Effect.acquireDisposable
  • test(effect): happy path and failure for Effect.acquireDisposable
  • test(effect): change assertTrue(equals to assertEquals
  • chore: add changeset

@datner datner requested a review from mikearnaldi as a code owner May 4, 2026 21:20
@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog May 4, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: 27ba280

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
effect Minor
@effect/cli Major
@effect/cluster Major
@effect/experimental Major
@effect/opentelemetry Major
@effect/platform-browser Major
@effect/platform-bun Major
@effect/platform-node-shared Major
@effect/platform-node Major
@effect/platform Major
@effect/printer-ansi Major
@effect/printer Major
@effect/rpc Major
@effect/sql-clickhouse Major
@effect/sql-d1 Major
@effect/sql-drizzle Major
@effect/sql-kysely Major
@effect/sql-libsql Major
@effect/sql-mssql Major
@effect/sql-mysql2 Major
@effect/sql-pg Major
@effect/sql-sqlite-bun Major
@effect/sql-sqlite-do Major
@effect/sql-sqlite-node Major
@effect/sql-sqlite-react-native Major
@effect/sql-sqlite-wasm Major
@effect/sql Major
@effect/typeclass Major
@effect/vitest Major
@effect/workflow Major
@effect/ai Major
@effect/ai-amazon-bedrock Major
@effect/ai-anthropic Major
@effect/ai-google Major
@effect/ai-openai Major
@effect/ai-openrouter Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-bot effect-bot changed the base branch from main to next-minor May 4, 2026 21:21
*
* @see {@link acquireRelease} for more information about scopes.
*
* @since 3.0.0
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk what to put here

): Effect.Effect<A, E, R | Scope.Scope>
} = (acquire) =>
acquireRelease(acquire, (resource) =>
Predicate.hasProperty(resource, Symbol.asyncDispose)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I just had a thought.
What if an object has both Dispose symbols—why does the asynchronous one take priority?
Maybe it would make sense to split this function into two, or allow configuring the priority?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the assumption is that if there is an async one the sync doesn't wait?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it has both dispose symbols, are both invoked? In which order?
The mdn suggests that async always takes priority and is even valid for sync cases, but I can't find a definition of behavior for using both symbols... Open to suggestions 🤷🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

4 participants